﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace SimpleActor.Test
{
    [TestClass]
    public class TestScenarios
    {
        [TestMethod]
        public void TestNormalShutdown()
        {
            var service = SampleServiceFactory.Create();
            var client = SampleClientFactory.Create(service);

            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} Begin Service-Start", DateTime.Now);
            service.Start().Wait();
            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} End Service-Start", DateTime.Now);


            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} Begin Client-Start", DateTime.Now);
            client.Start().Wait();
            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} End Client-Start", DateTime.Now);


            Thread.Sleep(TimeSpan.FromSeconds(10));

            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} Begin Client-Stop", DateTime.Now);
            client.Stop().Wait();
            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} End Client-Stop", DateTime.Now);


            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} Begin Service-Stop", DateTime.Now);
            service.Stop().Wait();
            Debug.WriteLine("{0:yyyy/MM/dd HH:mm:ss.fff} End Service-Stop", DateTime.Now);
        }
    }
}
